<!-- 配额管理 | 作者：menghao.yan | 邮箱：yxs2615@163.com | 时间：2023年08月22日 22:53:39 -->
<template>
  <a-tabs v-model:activeKey="activeKey" type="card" class="y-tabs">
    <a-tab-pane key="yongHuPeiE" tab="用户配额">
      <a-card>
        <a-row align="middle">
          <a-col :span="16">
            <a-space>
              <a-button type="link" class="y-btn" @click="openBianJiYongHuPeiEModal">
                <template #icon>
                  <plus-outlined />
                </template>
                编辑用户配额
              </a-button>
              <!-- 弹窗 - 编辑用户配额 -->
              <bianJiYongHuPeiEModal v-model:visible="visibleBianJiYongHuPeiEModal"></bianJiYongHuPeiEModal>
            </a-space>
          </a-col>
          <a-col :span="8">
            <a-input v-model:value="searchValueYongHuPeiE">
              <template #addonBefore>
                <search-outlined /> 搜索:
              </template>
            </a-input>
          </a-col>
        </a-row>
        <a-table bordered :data-source="dataSourceYongHuPeiE" :columns="columnsYongHuPeiE" class="y-table" :pagination="paginationYongHuPeiE">
        </a-table>
      </a-card>
    </a-tab-pane>

    <a-tab-pane key="zuPeiE" tab="组配额">
      <a-card>
        <a-row align="middle">
          <a-col :span="16">
            <a-space>
              <a-button type="link" class="y-btn" @click="openBianJiZuPeiEModal">
                <template #icon>
                  <plus-outlined />
                </template>
                编辑组配额
              </a-button>
              <!-- 弹窗 - 编辑组配额 -->
              <bianJiZuPeiEModal v-model:visible="visibleBianJiZuPeiEModal"></bianJiZuPeiEModal>
            </a-space>
          </a-col>
          <a-col :span="8">
            <a-input v-model:value="searchValueZuPeiE">
              <template #addonBefore>
                <search-outlined /> 搜索:
              </template>
            </a-input>
          </a-col>
        </a-row>
        <a-table bordered :data-source="dataSourceZuPeiE" :columns="columnsZuPeiE" class="y-table" :pagination="paginationZuPeiE">
        </a-table>
      </a-card>
    </a-tab-pane>
  </a-tabs>
</template>

<script setup>
import bianJiYongHuPeiEModal from './modal/bianJiYongHuPeiEModal.vue'
import bianJiZuPeiEModal from './modal/bianJiZuPeiEModal.vue'
const activeKey = ref('yongHuPeiE')

// -- 用户配额
const visibleBianJiYongHuPeiEModal = ref(false)

const openBianJiYongHuPeiEModal = () => {
  visibleBianJiYongHuPeiEModal.value = true
}

const searchValueYongHuPeiE = ref('')

// 表格列
const columnsYongHuPeiE = ref([
  {
    title: '目录名',
    dataIndex: 'name',
    key: 'name',
    align: 'center',
    sorter: {
      compare: (a, b) => a.name.localeCompare(b.name),
      multiple: 1
    }
  },
  {
    title: '状态',
    dataIndex: 'status',
    key: 'status',
    align: 'center',
    sorter: {
      compare: (a, b) => a.status.localeCompare(b.status),
      multiple: 2
    }
  }
])

// 表格数据
const dataSourceYongHuPeiE = ref([
  {
    key: '1',
    name: 'xx',
    status: '正常'
  },
  {
    key: '2',
    name: 'xx',
    status: '正常'
  },
  {
    key: '3',
    name: 'xx',
    status: '正常'
  },
  {
    key: '4',
    name: 'xx',
    status: '正常'
  }
])

// 分页
const paginationYongHuPeiE = {
  current: 1,
  pageSize: 10,
  showQuickJumper: true,
  showSizeChanger: true,
  total: 0,
  showTotal: (total, range) => {
    return `${range[0]}-${range[1]} 共 ${total} 条数据`
  },
  onChange: (page, pageSize) => {
    console.log('配额管理 > 用户配额分页改变>>', page, pageSize)
  }
}

// -- 组配额
const visibleBianJiZuPeiEModal = ref(false)

const openBianJiZuPeiEModal = () => {
  visibleBianJiZuPeiEModal.value = true
}

const searchValueZuPeiE = ref('')

// 表格列
const columnsZuPeiE = ref([
  {
    title: '目录名',
    dataIndex: 'name',
    key: 'name',
    align: 'center',
    sorter: {
      compare: (a, b) => a.name.localeCompare(b.name),
      multiple: 1
    }
  },
  {
    title: '状态',
    dataIndex: 'status',
    key: 'status',
    align: 'center',
    sorter: {
      compare: (a, b) => a.status.localeCompare(b.status),
      multiple: 2
    }
  }
])

// 表格数据
const dataSourceZuPeiE = ref([
  {
    key: '1',
    name: 'xx',
    status: '正常'
  },
  {
    key: '2',
    name: 'xx',
    status: '正常'
  }
])

// 分页
const paginationZuPeiE = {
  current: 1,
  pageSize: 10,
  showQuickJumper: true,
  showSizeChanger: true,
  total: 0,
  showTotal: (total, range) => {
    return `${range[0]}-${range[1]} 共 ${total} 条数据`
  },
  onChange: (page, pageSize) => {
    console.log('配额管理 > 组配额分页改变>>', page, pageSize)
  }
}
</script>

<style scoped lang='scss'>
.ant-row {
  margin-bottom: 10px;
}

.y-yongHu-table-name,
.y-zu-table-name {
  color: #67c23a;
}
</style>